package base

import (
	"github.com/spf13/viper"
	"infra"
	"log"
)

var config *viper.Viper

func Config() *viper.Viper {
	return config
}

type ConfigStarter struct {
	infra.BaseStarter
}

func (c *ConfigStarter) Init(ctx infra.StarterContext) {
	log.Println("Init config starter...")
	config = viper.New()
	config.SetConfigFile("conf/conf.ini")
	config.SetConfigType("ini")
	err := config.ReadInConfig()
	if err != nil {
		log.Fatal(err)
	}
}
